<template>
  <div class="wrapper">
    <el-input tyep="text" v-bind="$attrs" v-on="$listeners" @input="handleInput" v-model.lazy="message"></el-input>
  </div>
</template>
<script>
export default{
  name: "AddNewInputComp",
  inject: ['model'],
  data(){
    return {
      message: ""
    }
  },
  methods:{
    async handleInput(){
      await this.model.editorData({content: this.message})
      this.$emit("AddNewMessage", this.model.data.data);
      if(this.message.trim() === ""){
        this.$emit("AddNewMessage", '');
      }
    }
  }
}
</script>